define setupDNS($dns,$searchdomain) {
  include srv_network
  file { "resolv.conf":
    path => "/etc/resolv.conf",
    owner => root,
    group => root,
    mode => 644,
    content => template("networking/resolv.conf.erb"),
    ensure => present,
  }
}

define setupNetwork($hostname) {

  include srv_network

  file { "network":
    path => "/etc/sysconfig/network",
    owner => root,
    group => root,
    mode => 644,
    content => template("networking/network.erb"),
    notify => Service[network],
  }

}
  
define setupEth($device, $bootproto, $netmask="",$ipaddr="", $gateway="", $hwaddr="", $bridge="", $devtype="Ethernet",$onboot="yes", $userctl="no",$nm_controlled="no") {

  include srv_network
  
  file { "ifcfg-$device":
    path => "/etc/sysconfig/network-scripts/ifcfg-$device",
    owner => root,
    group => root,
    mode => 644,
    content => template("networking/ifcfg.erb"),
    ensure => present,
    notify => Service[network],
  }
  
}

class srv_network {
  
  package { "bridge-utils":
    ensure => installed,
  }
  
  service { network:
    ensure => "running",
    hasstatus => "true",
    hasrestart => "true",
    require => Package["bridge-utils"],
  }
  
}

